package com.lzh.farmersshop.config;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * @Class WebAppConfig
 * @Author ShiChaojie
 * @Email:scj0725@qq.com
 * 注册拦截器
 */
@Configuration
public class WebAppConfig implements WebMvcConfigurer {

    private final CustomInterceptor customInterceptor;

    @Autowired
    public WebAppConfig(CustomInterceptor customInterceptor) {
        this.customInterceptor = customInterceptor;
    }

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(customInterceptor);
    }
}
